////////////////////////////////////////////////////////////////////////////////
// Filename: L_dx11effect.cpp
////////////////////////////////////////////////////////////////////////////////
#include "L_dx11effect.h"

L_DX11Effect::L_DX11Effect()
{
	VertexShader = 0;
	PixelShader = 0;
}

L_DX11Effect::~L_DX11Effect()
{

}

bool L_DX11Effect::Init(	ID3D11Device* Device, D3D11_INPUT_ELEMENT_DESC* layout, unsigned int NumElements,
							string VSFileName, string VSEntryPoint, string VSShaderModel,
							string PSFileName, string PSEntryPoint, string PSShaderModel)
{
	VertexShader = new L_DX11VertexShader;
	if(!VertexShader->Init(Device, VSFileName, VSEntryPoint, VSShaderModel))
	{
		return false;
	}

	PixelShader = new L_DX11PixelShader;
	if(!PixelShader->Init(Device, PSFileName, PSEntryPoint, PSShaderModel))
	{
		return false;
	}

	if( FAILED(Device->CreateInputLayout( layout, NumElements, VertexShader->GetBuffer()->GetBufferPointer(),
		VertexShader->GetBuffer()->GetBufferSize(), &vertLayout ) ) )
	{
		return false;
	}

	return true;
}

ID3D11VertexShader* L_DX11Effect::GetVertexShader()
{
	return VertexShader->GetShader();
}

ID3D11PixelShader* L_DX11Effect::GetPixelShader()
{
	return PixelShader->GetShader();
}

ID3D11InputLayout* L_DX11Effect::GetLayout()
{
	return vertLayout;
}